<?php

class Damages_Methods_Data_Permission_Edit extends Damages_Methods_Data_Permission {

  /**
   *
   * @var Damages_Methods_Data_Processes_ProcessType_Edit[] 
   */
  public $processes = array();

  /**
   *
   * @var Damages_Methods_Data_List_Field[] 
   */
  public $fields = array();

  /**
   *
   * @var Damages_Methods_Data_List_Filter[] 
   */
  public $filters = array();

  public function __construct($obj) {
    $this->id = $obj->id;
  }

  public function setProcessTypes($obj) {
    if ($obj->processes)
      foreach ($obj->processes->toArray() as $process) {
        $this->processes[] = new Damages_Methods_Data_Processes_ProcessType_Edit($process);
      }
  }

  public function setFields($obj) {
    if ($obj->fields)
      foreach ($obj->fields->toArray() as $field) {
        $this->fields[] = new Damages_Methods_Data_List_Field_Edit($field);
      }
  }

  public function setFilters($obj) {
    if ($obj->filters)
      foreach ($obj->filters->toArray() as $filter) {
        $this->filters[] = new Damages_Methods_Data_List_Filter_Edit($filter);
      }
  }

}